home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Add-Ons / After Dark / The Swarm 1.5 / Source / The Swarm.h < prev    next >
Encoding:
Text File  |  1995-12-05  |  2.5 KB  |  59 lines  |  [TEXT/R*ch]

  1. /* The Swarm.h  --  type definitions & other header file stuff.
  2. */
  3.  
  4.      // Include file for the GWorld offscreen drawing stuff.
  5. #include <QDoffscreen.h>
  6.  
  7.  
  8.     // Data structures
  9. typedef short    **ShortHandle;        // Our Bee position arrays will be dynamic arrays
  10.                                     // allocated using handles.
  11.  
  12. typedef struct        // All data we use is stored in this struct.
  13. {
  14.     short queenX[2], queenY[2];                // Storage for Queen line segment.
  15.     short queenVelocityX, queenVelocityY;    // Current Queen velocity components.
  16.     ShortHandle beeX[2], beeY[2];            // Bee line segments.
  17.     ShortHandle beeVelocityX, beeVelocityY;    // Bee velocities components.
  18.  
  19.     Rect swarmRect;                 // Bounding rectangle for swarm at time '0'.
  20.     Rect oldRect;                    // Bounding rectangle for swarm at time '1'.
  21.     
  22.     short maxQueenVelocity, maxBeeVelocity;            // These variables store the constants
  23.     short maxQueenAcceleration, maxBeeAcceleration;    // defined earlier.
  24.     short border;                                    //
  25.     
  26.     short nBees;            // The current number of active Bees.
  27.     
  28.     long delay;                // The current animation speed depends on this value.
  29.     long startDrawing;        // Works together with delay to control animation speed.
  30.     
  31.     long switchColor;        // The current bee color-changing speed depends on this value.
  32.     long colStepCnt;        // Counter to 'count-up' until switchColor.
  33.     long colDirection;        // Controls the direction of the bee color changes.
  34.     long colIndex;            // CLUT index for the current bee color.
  35.     
  36.     Boolean demoMode;        // Are we currently in After Dark demo Mode?
  37.     Boolean doFade;            // Should we do a smooth fade?
  38.  
  39.     RGBColor whiteRGB, blackRGB;    // Color QuickDraw colors: white and black.
  40.     RGBColor queenRGB, beeRGB;        // Color QuickDraw colors for Queen and Bees.
  41.     RGBColor backRGB;                // Color QuickDraw color for animation background.
  42.       
  43.     Rect monitorRect;        // Rectangle corresponding to main monitor.
  44.     short winW, winH;        // The info about monitorRect we really need.
  45.  
  46.        GWorldPtr gMyOffG;        // A pointer to an offscreen graphics world.
  47. }
  48. TSwarmData, *TSwarmDataPtr;
  49.  
  50.     // A comment about this 'time t' business: each swarm member's
  51.     // line segment is drawn 'from' position 0 to position 1. So
  52.     // t=1 is the 'old' position, t=0 the 'new' position. After one
  53.     // frame of animation, e.g. QX(0) will be assigned to QX(1) (making
  54.     // that the 'old' position), and QX[0] will get a new value. In other 
  55.     // words, every swarm creature essentially traces a continuous path
  56.     // across the screen.
  57.     
  58.  
  59.